<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>积分活动的审核</title>
<script language="javascript" src="../script/common.js"></script>
<!--动态js-->
<script language="javascript">
		var orgs = Common.cOrg();	//当前单位
		var num=0;
		var qtlist={};
		var giftRuleList=[{code:"通过",text:"通过"},{code:"不通过",text:"不通过"}]
		function load(){
			Eui.showNavigation();
			$("search").orgn.value=orgs.id;
		     Common.initDict("idear",giftRuleList);
			Common.initDict(crelistform1.hqCheckState, "track_checkstate", "请选择");
			Common.initDict(crelistform1.areaCheckState, "track_checkstate", "请选择");
			Common.initDict(search.status, "apply_checkstate", "全部");
			Common.initDict(search.accLevel, "customer_level", "全部");
			setPages(["detview","listview2","datelistview"])
			createTable();
		}
		function xiugaiFunc(v,r){
		if(r[4]=="等待审核"){
		return "<a href=# onclick=\"onEdit('"+r[0]+"','"+r[1]+"','"+r[2]+"','"+r[3]+"','"+r[4]+"','"+r[5]+"','"+r[6]+"','"+r[7]+"','"+r[8]+"','"+r[9]+"','"+r[10]+"','"+r[11]+"');return false;\">审核</a>"
		}else{
		return "<a href=# onclick=\"onEdit('"+r[0]+"','"+r[1]+"','"+r[2]+"','"+r[3]+"','"+r[4]+"','"+r[5]+"','"+r[6]+"','"+r[7]+"','"+r[8]+"','"+r[9]+"','"+r[10]+"','"+r[11]+"');return false;\">查看</a>"
		}
		
			
		}
		function showrule(v,r){
			return "<a href=# onclick=\"shownewrule('"+r[0]+"','"+r[1]+"','"+r[2]+"','"+r[3]+"','"+r[4]+"','"+r[5]+"','"+r[6]+"','"+r[8]+"');return false;\">查看</a>"
		}
		function createTablePointRulePro(){
				var columns =[];				
				qtPro = new QueryTable("loy_PointRulePro","showRuleForm","prodatalist",columns,"");
				qtPro.showTable();
			}
			function createTablePointRuleCalFun(){
				var columns =[];			
				qtFun = new QueryTable("loy_PointRuleCalFun","showRuleForm","fundatalist",columns,"");
				qtFun.showTable();
			}	
		function createTable(){		   
			var columns = [];
			columns[10]={title:"操作",width:"6%",render:xiugaiFunc}
			
			qt = new QueryTable("loy_crelist","search","datalist",columns);				
			switchPage("listview2");
		}	
		function createTableList(){
			var columns = [];
			columns[8]={title:"操作",width:"6%",render:showrule}
			qtlist = new QueryTable("loy_point_crelist","crelistform","dlist",columns);				
		}
		function shownewrule(name,dec,ruletype,funtype,start,end,num,id){
		$("rulename2").innerHTML=name;
		$("rulecom2").innerHTML=dec;
		$("startTime2").innerHTML=start;
		$("endTime2").innerHTML=end;
		$("guizemoban2").innerHTML=ruletype;
		$("caltype2").innerHTML=funtype;
		$("ruleban2").innerHTML=num;
		$("showRuleForm").ruleid.value=id; 
		 switchPage('datelistview');
		 createTablePointRulePro();
		 createTablePointRuleCalFun();     
		}			
		//显示、刷新表格
		function showData(){
			qt.showTable();
		}
		function showDataList(){
			qtlist.showTable();
		}
		function setOrg1(sorg){
		}
		function onEdit(name,dec,stime,etime,state,type,varValue,time,oper,orgg,actid,id){
		   if(state=="审核结束"){
		    $('pp').style.display = "none";
		    }
		 $('listview').style.display = "none";
		     $('detview').style.display = "";
		     $("actname").innerHTML=name;	
		     $("actdec").innerHTML=dec;	
		     $("stime").innerHTML=stime;	
		     $("etime").innerHTML=etime;	
		     $("type").innerHTML=type;	
		     $("states").innerHTML=state;
		     $("sendtime").innerHTML=time;
		     $("varValue").innerHTML=varValue;	
		     $("sendoper").innerHTML=oper;	
			$("sendorg").innerHTML=orgg;	
			$("crelistform").act.value=actid;
			$("crelistform").checkflowid.value=id;
		     createTableList();
		     showDataList();
			switchPage("detview");
		}
		function back(){
		switchPage("detview");
		}
		function onSave(){
		var comments=$("crelistform1").comments.value;
		var varVal=$("crelistform1").idear.value;
		var checkflowid=$("crelistform").checkflowid.value;
		DWR.call('giftProjectService.checkGiftRule',checkflowid,varVal,comments,function(v){
		    showInformation("审核完毕!");
		    $('listview').style.display = "";
		     createTable();
          	switchPage('listview2');
		   });	
		}
		function Cancla(){
			$('listview').style.display = "";
			createTable();
			switchPage('listview2');
		}
		function backshowsend(){
		    
			switchPage('detview');
		}
		function   validateTextCounter(obj,maxlimit){ 
        var   maxlimit=80; 
        if   (obj.value.length > maxlimit){ 
         alert( "最多只能输入80个字符 "); 
         obj.value = obj.value.substring(0,maxlimit); 
          } 
       } 
		</script>
</head>
<body onload="load()">
<div class="nav">
<div id="nav">&nbsp;</div>
</div>
<div id="content">
<div id="listview">
<div class="searchForm">
<form id="search" name="search">
	<input type=hidden id="orgn" name="orgn">
<table cellSpacing=0 cellPadding=4 width="100%" border=0>
	<tr>
		<td><label>审核状态</label> <select name="status"></select></td>
		<td>
		<button type="button" onclick="showData()">查 询</button>
		</td>
	</tr>
</table>
</form>
</div>
</div>
<div id="listview2" style='display: none;'>
<div id=datalist></div>
</div>
<!--明细(新增)静态页面部分-->
<div id=detview style='display: none;' align=center>
<form id='crelistform' name='crelistform' method='POST'
	enctype='multipart/form-data' action='/upload/pic/'><input
	type=hidden id=act name=act> <input type=hidden id=checkflowid
	name=checkflowid>
<div class=form>
<div class="formTitle">积分活动信息</div>
<table cellSpacing=0 cellPadding=4 width="100%" border=0
	class="col3 label6">
	<tr>
		<td><label>积分活动名称</label> <span id="actname"></span></td>
		<td><label>积分活动描述</label> <span id="actdec"></span></td>

	</tr>
	<tr>
		<td><label>活动开始时间</label> <span id="stime"></span></td>
		<td><label>活动结束时间</label> <span id="etime"></span></td>

	</tr>
	<tr>
		<td><label>审核状态</label> <span id="states"></span></td>
		<td><label>审核意见</label> <span id="varValue"></span></td>

	</tr>
	<tr>
		<td><label>提交时间</label> <span id="sendtime"></span></td>
		<td><label>审核类型</label><font color="#FF7933" size=4><span  id="type"></span></font></td>
	</tr>
	<tr>
		<td><label>提交人</label> <span id="sendoper"></span></td>
		<td><label>提交机构</label> <span id="sendorg"></span></td>
	</tr>
</table>
</div>
</form>

<div id="dlist"></div>
<form id='crelistform1' name='crelistform1' method='POST'
	enctype='multipart/form-data' action='/upload/pic/'>
<div class=form name=pp id=pp align=center>
<table cellSpacing=0 cellPadding=5 width="100%" border=0
	class="col3 label6">
<tr>
	<td><label>审核意见</label>
	<select name="idear" onblur="checkV(this,'',true)"></select><font color="red">&nbsp;*</font>
	<button type="button" onclick="onSave()">审核确认</button>
	</td>
	<tr>
     <td><label align="center">反馈意见</label><textarea name="contents" cols="80" onkeyup= " validateTextCounter(this); "   onchange= " validateTextCounter(this); "rows="4" id="comments"> </textarea></td>
	
	</tr>
	
</tr>
</table>
</div>
</form>
<button type="button" onclick="Cancla()">返回</button>
</div>
</div>
<div id="datelistview" style='display: none;'>
<div class="form">
<form id="showRuleForm" name="showRuleForm"><input
	type="hidden" name="ruleid" id="ruleid"> <input type="hidden"
	name="aa" id="aa">
<table cellSpacing=0 cellPadding=4 width="100%" border=0>
	<tr>
		<td><label>规则名称</label>&nbsp;<span id="rulename2"></span></td>
		<td><label>规则描述</label>&nbsp;<span id="rulecom2"></span></td>
	</tr>
	<tr>
		<td><label>开始日期</label>&nbsp; <span id="startTime2"></span></td>
		<td><label>结束日期</label> &nbsp;<span id="endTime2"></span></td>
	</tr>
	<tr>
		<td><label>规则模板</label>&nbsp;<span id="guizemoban2"></span></td>
		<td><label>计算类型</label>&nbsp;<span id="caltype2"></span></td>

	</tr>
	<tr>
		<td><label>规则版本号</label>&nbsp;<span id="ruleban2"></span></td>
		<td>
		<p>
		<button type="button" name="savegroupbt3" onclick="backshowsend()">返回</button>
		</p>
		</td>
	</tr>
</table>
</form>
</div>
<table cellSpacing=0 cellPadding=4 width="100%" border=0>
	<tr>
		<td width="50%">
		<div id="prodatalist"></div>
		</td>
		<td width="50%">
		<div id="fundatalist"></div>
		</td>
	</tr>
</table>
</body>
</html>